import 'package:flutter_base_plugin/base_library/base_interfaces/i_http_bean_config.dart';
import 'package:flutter_base_plugin_example/models/cart_model.dart';
import 'package:flutter_base_plugin_example/models/goods_details_model.dart';
import 'package:flutter_base_plugin_example/models/goods_model.dart';
import 'package:flutter_base_plugin_example/models/home_product_model.dart';
import 'package:flutter_base_plugin_example/models/login_model.dart';

import '../models/category_model.dart';
import '../models/goods_model.dart';
import '../models/img_code_model.dart';
import '../page/user/m/user_model.dart';

class HttpBeanImpl implements IHttpBean {
  @override
  List<int> configHttpSuccessCodeList() {
    // TODO: implement configHttpSuccessCodeList
    return [200];
  }

  @override
  String configCode() {
    // TODO: implement configCode
    return "status";
  }

  @override
  String configData() {
    // TODO: implement configData
    return "data";
  }

  @override
  String configList() {
    // TODO: implement configList
    return "data";
  }

  @override
  String configMsg() {
    // TODO: implement configMsg
    return "msg";
  }

  @override
  T parseJsonToObject<T>(json) {
    // TODO: implement parseJsonToObject
    if (T.toString() == "UserModel") {
      return UserModel.fromJson(json) as T;
    }
    if (T.toString() == "ImgCodeModel") {
      return ImgCodeModel.fromJson(json) as T;
    }
    if (T.toString() == "CartModel") {
      return CartModel.fromJson(json) as T;
    }
    if (T.toString() == "LoginModel") {
      return LoginModel.fromJson(json) as T;
    }
    if (T.toString() == "GoodsModel") {
      return GoodsModel.fromJson(json) as T;
    }
    if (T.toString() == "GoodsDetailsModel") {
      return GoodsDetailsModel.fromJson(json) as T;
    }
    if (T.toString() == "HomeProductModel") {
      return HomeProductModel.fromJson(json) as T;
    }
    if (T.toString() == "CategoryModel") {
      return CategoryModel.fromJson(json) as T;
    }
    return json as T;
  }
}
